package UserInterface;

import javax.swing.JPanel;

import java.awt.Color;

import javax.swing.JLabel;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;

import java.awt.Font;
import java.awt.event.ActionListener;

import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.LayoutStyle.ComponentPlacement;

public class UsersBalance extends JPanel {
	private JLabel textFieldUanBalance;
	private JLabel textFieldUSDBalance;
	private JLabel textFieldEURBalance;
	private JButton btnBack = new JButton("<< Back");
	JButton btnOk = new JButton("OK");
	JButton btnCancel = new JButton("Cancel");
	public void setBalance(int balance){
		textFieldUanBalance.setText(Integer.toString(balance));
	}
	
	public void setUserBalanceOkListener(ActionListener list){
		btnOk.addActionListener(list);
	}
	public void setUserBalanceCancelListener(ActionListener list){
		btnCancel.addActionListener(list);
	}

	public void setUserBalanceBackListener(ActionListener list){
		btnBack.addActionListener(list);
	}


	/**
	 * Create the panel.
	 */
	public UsersBalance() {
		setBackground(new Color(255, 248, 220));
		this.setSize(500, 500);
		
		JLabel lblBalance = new JLabel("Your balance :");
		lblBalance.setForeground(new Color(128, 0, 0));
		lblBalance.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 18));
		
		JLabel lblUan = new JLabel("UAN:");
		lblUan.setFont(new Font("Tahoma", Font.BOLD, 14));
		
		textFieldUanBalance = new JLabel("",10);
		textFieldUanBalance.setFont(new Font("Tahoma", Font.PLAIN, 14));
		//textFieldUanBalance.setColumns(10);
		
		JLabel lblUsd = new JLabel("");
		lblUsd.setFont(new Font("Tahoma", Font.BOLD, 14));
		
		textFieldUSDBalance = new JLabel("",10);
		textFieldUSDBalance.setFont(new Font("Tahoma", Font.PLAIN, 14));
		//textFieldUSDBalance.setColumns(10);
		
		JLabel lblEur = new JLabel("");
		lblEur.setFont(new Font("Tahoma", Font.BOLD, 14));
		
		textFieldEURBalance = new JLabel("",10);
		textFieldEURBalance.setFont(new Font("Tahoma", Font.PLAIN, 14));
		//textFieldEURBalance.setColumns(10);
		
		
		btnBack.setFont(new Font("Tahoma", Font.BOLD, 14));
		
		
		btnOk.setFont(new Font("Tahoma", Font.BOLD, 14));
		
		
		btnCancel.setFont(new Font("Tahoma", Font.BOLD, 14));
		GroupLayout groupLayout = new GroupLayout(this);
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.TRAILING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(178)
							.addComponent(lblBalance))
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(20)
							.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
								.addGroup(groupLayout.createSequentialGroup()
									.addComponent(lblUsd, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE)
									.addGap(30)
									.addComponent(textFieldUSDBalance, GroupLayout.PREFERRED_SIZE, 328, GroupLayout.PREFERRED_SIZE))
								.addGroup(groupLayout.createSequentialGroup()
									.addComponent(lblUan)
									.addGap(30)
									.addComponent(textFieldUanBalance, GroupLayout.PREFERRED_SIZE, 328, GroupLayout.PREFERRED_SIZE))
								.addGroup(groupLayout.createSequentialGroup()
									.addComponent(lblEur, GroupLayout.PREFERRED_SIZE, 36, GroupLayout.PREFERRED_SIZE)
									.addGap(30)
									.addComponent(textFieldEURBalance, GroupLayout.PREFERRED_SIZE, 328, GroupLayout.PREFERRED_SIZE))
								.addGroup(Alignment.TRAILING, groupLayout.createSequentialGroup()
									.addComponent(btnBack, GroupLayout.PREFERRED_SIZE, 132, GroupLayout.PREFERRED_SIZE)
									.addGap(27)
									.addComponent(btnCancel, GroupLayout.PREFERRED_SIZE, 130, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(ComponentPlacement.RELATED, 39, Short.MAX_VALUE)
									.addComponent(btnOk, GroupLayout.PREFERRED_SIZE, 130, GroupLayout.PREFERRED_SIZE)
									.addPreferredGap(ComponentPlacement.RELATED)))))
					.addContainerGap(22, GroupLayout.PREFERRED_SIZE))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addGap(24)
					.addComponent(lblBalance)
					.addGap(35)
					.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
						.addComponent(lblUan)
						.addComponent(textFieldUanBalance, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(37)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(lblUsd, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
						.addComponent(textFieldUSDBalance, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGap(40)
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addComponent(lblEur, GroupLayout.PREFERRED_SIZE, 17, GroupLayout.PREFERRED_SIZE)
						.addComponent(textFieldEURBalance, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(97)
							.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
								.addComponent(btnBack, GroupLayout.PREFERRED_SIZE, 41, GroupLayout.PREFERRED_SIZE)
								.addComponent(btnOk, GroupLayout.PREFERRED_SIZE, 41, GroupLayout.PREFERRED_SIZE)))
						.addGroup(groupLayout.createSequentialGroup()
							.addGap(98)
							.addComponent(btnCancel, GroupLayout.PREFERRED_SIZE, 41, GroupLayout.PREFERRED_SIZE)))
					.addContainerGap(134, Short.MAX_VALUE))
		);
		setLayout(groupLayout);
	     
	    
	     
	}
	

}
